Reading Medications and Dose Events PRO
The Scripting app provides read access to the Medications a person tracks in the Health app, together with their logged dose events, using Health.queryMedications() and Health.queryMedicationDoseEvents().
Requires iOS 26.0 or later. On earlier systems both functions reject with an error.
This guide explains how to list a person's medications and how to read the doses they logged.
Medications and Dose Events
- A medication (
HealthUserAnnotatedMedication) is something the person tracks in the Health app. It carries anickname, anisArchivedflag, ahasScheduleflag, and amedicationconcept. - A medication concept (
HealthMedicationConcept) describes the medication itself: a stableidentifier, adisplayTextname, ageneralForm(such as"tablet"or"injection"), andrelatedCodings(such as RxNorm codes). - A dose event (
HealthMedicationDoseEvent) is a single logged dose — taken, skipped, snoozed, or not interacted with. It links back to a medication throughmedicationConceptIdentifier.
Permission
Both functions automatically ask the person to choose which medications Scripting may read. Access to a selected medication also covers its dose events; there is no separate dose-event permission. You can call Health.queryMedicationDoseEvents() directly without first loading the medication list.
The system may show the medication selection sheet again on later queries so the person can review their choices. Queries return only data for medications they share. An empty result can mean no medications were shared or no records match the query; it does not prove that reading was authorized. Closing the selection sheet can complete the query with an empty result. Handle request failures with try/catch; neither successful completion nor an empty result proves that access was granted.
API Overview
Example: Listing Active Medications
Example: Reading Today's Dose Events
Example: Doses for a Specific Medication
Use a medication's identifier to fetch only its doses:
Notes
Health.queryMedications()returnsHealthUserAnnotatedMedicationinstances;Health.queryMedicationDoseEvents()returnsHealthMedicationDoseEventinstances.scheduledDateandscheduledDoseQuantityare only present for scheduled dose events (scheduleType === "schedule"); they arenullfor as-needed doses.- A dose event's
medicationConceptIdentifiermatches theidentifierof the medication's concept, so you can group doses by medication. - These APIs are read-only — medications and dose events are managed by the Health app and can't be created from a script.
Summary
- Use
Health.queryMedications()to list the medications a person tracks. - Use
Health.queryMedicationDoseEvents()to read logged doses, filtered by date, status, schedule window, or medication. - Link the two with
HealthMedicationConcept.identifier/HealthMedicationDoseEvent.medicationConceptIdentifier.
